xen/arm: Construct the P2M pages pool for guests
authorHenry Wang <Henry.Wang@arm.com>
Mon, 6 Jun 2022 06:17:28 +0000 (06:17 +0000)
committerJan Beulich <jbeulich@suse.com>
Tue, 11 Oct 2022 12:28:39 +0000 (14:28 +0200)
commit55914f7fc91a468649b8a3ec3f53ae1c4aca6670
tree6282014a66b60d95a72a8a066fe506893a7b7f5a
parent156a239ea288972425f967ac807b3cb5b5e14874
xen/arm: Construct the P2M pages pool for guests

This commit constructs the p2m pages pool for guests from the
data structure and helper perspective.

This is implemented by:

- Adding a `struct paging_domain` which contains a freelist, a
counter variable and a spinlock to `struct arch_domain` to
indicate the free p2m pages and the number of p2m total pages in
the p2m pages pool.

- Adding a helper `p2m_get_allocation` to get the p2m pool size.

- Adding a helper `p2m_set_allocation` to set the p2m pages pool
size. This helper should be called before allocating memory for
a guest.

- Adding a helper `p2m_teardown_allocation` to free the p2m pages
pool. This helper should be called during the xl domain destory.

This is part of CVE-2022-33747 / XSA-409.

Signed-off-by: Henry Wang <Henry.Wang@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/include/asm/domain.h
xen/arch/arm/include/asm/p2m.h
xen/arch/arm/p2m.c